package dao.impl;

import dao.Top10CategoryDao;
import domain.Top10Category;
import domain.Top10Session;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import util.JDBCUtils;

import java.util.List;

public class Top10CategoryDaoImpl implements Top10CategoryDao {
    private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());

    @Override
    public List<Top10Category> SelectAll() {
        String sql = "SELECT categoryid,clickCount,orderCount,payCount FROM top10_category";
        List<Top10Category> query = template.query(sql, new BeanPropertyRowMapper<Top10Category>(Top10Category.class));
        return query;
    }
}
